package com.usooft.metaTalent.core.wx.service;

import com.usooft.framework.core.query.Page;
import com.usooft.metaTalent.core.wx.entity.WxOpenUser;
import com.usooft.metaTalent.core.wx.query.WxOpenUserQuery;
import com.usooft.metaTalent.core.wx.wrapper.WxOpenUserWrapper;
import org.springframework.lang.NonNull;

import java.util.List;
import java.util.Optional;

public interface WxOpenUserService {

    // region 自动生成
    WxOpenUser get(Long id);

    Optional<WxOpenUser> find(Long id);

    List<WxOpenUserWrapper> list(WxOpenUserQuery query);

    Page<WxOpenUserWrapper> page(WxOpenUserQuery query);

    int count(WxOpenUserQuery.Filter filter);

    /**
     * 根据指定的OpenID查找微信开放平台用户
     *
     * @param openId OpenID
     * @return 微信开放平台用户
     */
    Optional<? extends WxOpenUser> findByOpenId(@NonNull String openId);
    // endregion

    Optional<WxOpenUser> findByUnionId(String unionId);

    WxOpenUser create(String unionId, String openId);

    void edit(WxOpenUser wxOpenUser);
}